package com.jingtuo.android.fragment;

import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.jingtuo.android.R;
import com.jingtuo.android.common.CacheManager;
import com.jingtuo.android.common.app.BaseFragment;
import com.jingtuo.android.common.os.BitmapInfo;
import com.jingtuo.android.common.widget.MultiTouchView;

public class PicturePreviewFragment extends BaseFragment {
	
	public static final String EXTRA_PICTURE = "EXTRA_PICTURE";
	
	private View mView;
	
	private BitmapInfo mBitmapInfo;
	
	private CacheManager cacheManager;
	
	@Override
	public void onAttach(Activity activity) {
		// TODO Auto-generated method stub
		super.onAttach(activity);
		Bundle args = getArguments();
		cacheManager = CacheManager.getInstance(getString(R.string.app_name));
		if(args!=null){
			mBitmapInfo = (BitmapInfo)args.getParcelable(EXTRA_PICTURE);
		}
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		mView = inflater.inflate(R.layout.picture_preview_item, container, false);
		MultiTouchView multiTouchView = (MultiTouchView)mView.findViewById(R.id.picture_preview_item_mtv);
		multiTouchView.setDragEnabled(false);
		cacheManager.setImageView(multiTouchView, mBitmapInfo);
		return mView;
	}
	
}
